package org.soenea.doitall.application.dispatcher;

import java.io.IOException;

import javax.servlet.ServletException;
import org.dsrg.soenea.domain.command.CommandException;
import org.soenea.doitall.domain.command.LoginCommand;
import org.soenea.doitall.domain.command.exception.UserisAdminException;

public class Login extends Dispatcher {
	
	@Override
	public void execute() throws ServletException, IOException {
		try {
			new LoginCommand(this.myHelper).execute();
			System.out.println("Login forward");
			forward("/WEB-INF/jsp/LoginTV.jsp");
		} catch( UserisAdminException ex){
			System.out.println("trying to go to upload CVS file: ");
			forward("/WEB-INF/jsp/UploadCVSFile.jsp");
			
		}
		catch (final CommandException e) {
			throw new ServletException(e);
		}
	}
}
